<template>
	<view>  
		<cu-custom style="height: 0px;"  class="navBox" bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">设备备件</block>
		</cu-custom>
		<view class="container">
			<view class="top_bg">
				<view class="number_sy_box">
					<view class="number_sy_box_title">
						<text></text>
						<text style="position: absolute; right: 20rpx;z-index: 9999; font-size: 24rpx;color: #6c6c6c;">
						</text>
					</view>
					<view class="number_sy_main">
						<view @click="goSpare(2)" style="width: 50%; text-align: center; border-right: 1px solid #eee;">
							<view class="number_num_red">{{counts.yujing}}</view>
							<view class="danwei">库存预警</view>
						</view>
						<view  @click="goSpare(3)" style="width: 50%; text-align: center; z-index: 9999;">
							<view class="number_num2">{{counts.guoliang}}</view>
							<view class="danwei">库存过量</view>
						</view>

						<image mode="widthFix" class="xiaoding_bg" :src="icon"></image>
					</view>
				</view>
			</view>
			<view class="top_bg1">
			</view>

			<view class="box">
				<view @click="goWhere(item.en)" class="eachitem" v-for="(item,index) in rankList1" :key="index">
					<view class="leftImg">
						<image :src="item.icon"></image>
					</view>

					<view class="centerText">
						<view class="itemName">
							<text>{{item.name}}</text>
						</view>
					</view>
					
					<view class="rightImg">
						<image src="@/static/chevron-right.png"></image>
					</view>
				</view>
				<view style="margin-top: 40rpx;">
					<view class="eachitem" v-for="(item,index) in rankList2" :key="index">
						<view class="leftImg">
							<image :src="item.icon"></image>
						</view>
					
						<view class="centerText">
							<view class="itemName">
								<text>{{item.name}}</text>
							</view>
						</view>
						
						<view class="rightImg">
							<image src="@/static/chevron-right.png"></image>
						</view>
					</view>
				</view>
				<view style="margin-top: 40rpx;">
					<view class="eachitem" v-for="(item,index) in rankList3" :key="index">
						<view class="leftImg">
							<image :src="item.icon"></image>
						</view>
					
						<view class="centerText">
							<view class="itemName">
								<text>{{item.name}}</text>
							</view>
						</view>
						
						<view class="rightImg">
							<image src="@/static/chevron-right.png"></image>
						</view>
					</view>
				</view>
				<view style="margin-top: 40rpx;">
					<view @click="goWhere(item.en)"  class="eachitem" v-for="(item,index) in rankList4" :key="index">
						<view  class="leftImg">
							<image  :src="item.icon">
							</image>
						</view>
					
						<view style="position: relative;" class="centerText">
							<view v-if="counts.Outbound>0" style="top: 6rpx;right: 10rpx;" class="cu-tag badge">{{counts.Outbound}}</view>
							<!-- <view style="top: 6rpx;right: 10rpx;" class="cu-tag badge">1</view> -->
							<view class="itemName">
								<text>{{item.name}}</text>
							</view>
						</view>
						
						<view class="rightImg">
							<image src="@/static/chevron-right.png"></image>
						</view>
					</view>
					<view @click="goWhere(item.en)"  class="eachitem" v-for="(item,index) in rankList5" :key="index">
						<view  class="leftImg">
							<image  :src="item.icon">
							</image>
						</view>
					
						<view style="position: relative;" class="centerText">
							<view class="itemName">
								<text>{{item.name}}</text>
							</view>
						</view>
						
						<view class="rightImg">
							<image src="@/static/chevron-right.png"></image>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import request from "@/common/request.js";
	import unifab from "@/components/beyondGod-drag/beyoundGod-drag.vue";
	export default {
		data() {
			return {
				counts:{
					Outbound:0,
					yujing:0,
					guoliang:0,
				},
				icon:this.$request22.baseUrl1+'/Resource/Sg/Intersect.png',
				rankList1:[
					{
						icon:this.$request22.baseUrl1+'/Resource/Sg/spare/sparelist.png',
						name:'备件列表',
						en:'sparelist'
					},
					// {
					// 	icon:this.$request22.baseUrl1+'/Resource/Sg/spare/addspare.png',
					// 	name:'添加备件',
					// 	en:'addspare'
					// }
				],
				rankList2:[
					// {
					// 	icon:this.$request22.baseUrl1+'/Resource/Sg/spare/chuku.png',
					// 	name:'出库',
					// },{
					// 	icon:this.$request22.baseUrl1+'/Resource/Sg/spare/histry.png',
					// 	name:'出库历史',
					// }
				],rankList3:[
					// {
					// 	icon:this.$request22.baseUrl1+'/Resource/Sg/spare/ruku.png',
					// 	name:'入库',
					// },{
					// 	icon:this.$request22.baseUrl1+'/Resource/Sg/spare/histry2.png',
					// 	name:'入库历史',
					// }
				],
				rankList4:[
					{
						icon:this.$request22.baseUrl1+'/Resource/Sg/spare/spareshenqing.png',
						name:'备件领用审核',
						en:'outboundSpare'
					}
				],
				rankList5:[
					{
						icon:this.$request22.baseUrl1+'/Resource/Sg/spare/shenhehistry.png',
						name:'审核通过历史',
						en:'outboundSpareHistry2'
					},
					{
						icon:this.$request22.baseUrl1+'/Resource/Sg/spare/shenhehistry2.png',
						name:'审核驳回历史',
						en:'outboundSpareHistry3'
					}
				],
			}
		},
		mounted() {
			let that=this
			that.GetSpareCounts()
		},
		methods: {
			GetSpareCounts(){
				let that=this
				uni.getStorage({
					key: 'sparecounts',
					success: function (sparecounts) {
						that.counts=sparecounts.data
					}
				})
			},
			goWhere(en){
				if(en=='sparelist'){
					uni.navigateTo({
						url: '/pages-device/spare/sparelist'
					})
				}
				if(en=='addspare'){
					uni.navigateTo({
						url: '/pages-device/spare/addspare'
					})
				}
				if(en=='outboundSpare'){
					uni.navigateTo({
						url: '/pages-device/spare/outboundSpare?status=1'
					})
				}
				if(en=='outboundSpareHistry2'){
					uni.navigateTo({
						url: '/pages-device/spare/outboundSpare?status=2'
					})
				}
				if(en=='outboundSpareHistry3'){
					uni.navigateTo({
						url: '/pages-device/spare/outboundSpare?status=3'
					})
				}
			},
			goSpare(type){
				uni.navigateTo({
					url: '/pages-device/spare/sparelist?spareType='+type
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.eachitem{
		background-color: white;
		border-bottom: 1px solid #e1e1e1;
		width:100%;
		height: 100rpx;
		display: flex;
		align-items: center;
		.sort{
			font-size: 16px;
			color: #888888;
			line-height: 130rpx;
			margin-left: 10rpx;
			margin-right: 5rpx;
		}
		.leftImg{
			margin-left: 30rpx;
			margin-right: 30rpx;
			image{
				width:50rpx;
				height: 50rpx;
			}
			
		}
		.centerText{
			width: 70%;
			.itemName{
				:nth-child(1){
					font-weight: 500;
					font-size: 30rpx;
					color: black;
				}
				
				:nth-child(2){
					margin-left: 10rpx;
				}
				margin-bottom: 5rpx;
			}
			.itemAddress{
				display: flex;
				align-items: center;
				:nth-child(2){
					margin:0 6rpx;
				}
				.area{
					color: #37afe2;
					width: 70%;
					height: 40rpx;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis
				}
			}
		}
		.rightImg{
			image{
				width:50rpx;
				height: 50rpx;
			}
			
		}
	}
	.box{
		width:100%;
		margin-top: 50rpx;
	}
	.container {
		position: relative;
	}
	
	.top_bg {
		width: 750rpx;
		height: 140rpx;
		position: relative;
	}
	.top_bg1 {
		width: 750rpx;
		height: 40rpx;
		position: relative;
	}
	.one_box {
		width: 750rpx;
		height: 350rpx;
		line-height: 350rpx;
		position: absolute;
		left: 0;
		bottom: 110rpx;
		display: flex;
		justify-content: space-around;
		coloe:white;
	}
	.number_num_red{
		font-size: 44rpx;
		font-weight: 500;
		color: red;
	}
	.number_num111 {
		font-size: 50rpx;
		font-weight: 500;
		color: white;
	}

	.top_name {
		width: 100%;
		height: 55rpx;
		line-height: 60rpx;
		color: #f2f2f2;
		font-size: 26rpx;
		text-align: center;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.top_sy {
		width: 100%;
		height: 40rpx;
		line-height: 40rpx;
		font-size: 24rpx;
		color: rgba(255, 255, 255, .7);
		text-align: center;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.top_sy span {
		font-size: 20rpx !important;
	}

	.num_one {
		position: relative;
	}

	.huangguan1 {
		width: 60px;
		height: 60px;
		position: absolute;
		right: -10rpx;
		top: -18*2rpx;
	}

	.num_one .top3_head {
		width: 150rpx;
		height: 150rpx;
		border-radius: 100%;
		margin: 15rpx 0 0 30rpx;
		border: 4rpx solid #ffdd3c;
	}

	.num_two {
		position: relative;
	}

	.huangguan2 {
		width: 100rpx;
		height: 100rpx;
		position: absolute;
		right: 15rpx;
	}

	.num_two .top3_head {
		width: 120rpx;
		height: 120rpx;
		border-radius: 100%;
		margin: 45rpx 0 0 45rpx;
		border: 4rpx solid #bcdcdf;
	}

	.num_three {
		position: relative;
	}

	.huangguan2 {
		width: 100rpx;
		height: 100rpx;
		position: absolute;
		right: 15rpx;
	}

	.num_three .top3_head {
		width: 120rpx;
		height: 120rpx;
		border-radius: 100%;
		margin: 45rpx 0 0 45rpx;
		border: 4rpx solid #e29d85;
	}

	// 第二块
	.number_sy_box {
		width: 700rpx;
		height: 170rpx;
		background-color: #FFFFFF;
		position: absolute;
		left: 25rpx;
		border-radius: 20rpx;
		top:30rpx;
		z-index: 999;
		padding: 22rpx;
		box-shadow: 3px 3px 15px 3px rgba(0, 0, 0, 0.1)
	}

	.number_sy_box_title {
		color: #888888;
		// font-weight: 500;
		font-size: 28rpx;
		display: flex;
		z-index: 9999;
		justify-content: space-between;
	}

	.number_sy_main {
		width: 100%;
		height: 124rpx;
		padding-top: 20rpx;
		line-height: 52rpx;
		// background: red;
		display: flex;
		justify-content: space-around;
		position: relative;
	}

	.xiaoding_bg {
		position: absolute;
		right: -22rpx;
		bottom: -30rpx;
		width: 180rpx;
	}

	.number_num1 {
		font-size: 70rpx;
		font-weight: 500;
		color: #2fc04f;
	}

	.number_num2 {
		font-size: 44rpx;
		font-weight: 500;
		color: #224A9F;
	}

	.danwei {
		height: 60rpx;
		line-height: 60rpx;
		font-size: 26rpx;
		color: #303133;
	}

	// 列表
	.rankList_box {
		width: 750rpx;
		min-height: 200rpx;
		margin-top: 130rpx;
	}

	.rankItem:last-child {
		border: none;
	}

	.rankItem {
		width: 700rpx;
		height: 140rpx;
		margin: 0px auto;
		border-bottom: 1px solid #e9e9e9;
	}

	.rankIndex {
		width: 60rpx;
		height: 140rpx;
		line-height: 140rpx;
		text-align: center;
		color: #CCCCCC;
		font-size: 40rpx;
		float: left;
	}

	.HeardBox {
		width: 80rpx;
		height: 80rpx;
		margin: 10rpx;
		// border-radius: 100%;
		overflow: hidden;
		float: left;
		margin-right: 25rpx;
		margin-left: 10rpx !important;
	}


	.NameBox {
		width: 400rpx;
		height: 140rpx;
		float: left;
		padding-top: 10rpx;
		box-sizing: border-box;
	}

	.NameBox view {
		height: 50rpx;
		line-height: 70rpx;
	}

	.userName {
		min-width: 90rpx;
		font-size: 30rpx;
		float: left;
		margin-right: 20rpx;
	}

	.download_box {
		width: 80rpx;
		height: 140rpx;
		// background-color: red;
		float: right;

	}

	.download_box image {
		width: 45rpx;
		margin: 50rpx auto;
		display: block;
	}
</style>
